<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        console.log(2..toString());

        let obj = {
            num: 10,
            toString() {
                console.log('执行了toString');
                return this.num += 10;
            },
            valueOf() {
                console.log('执行了valueOf');
                return this.num += 20;
            }
        }

        alert(obj);
        console.log(obj);
        console.log(obj++);
        console.log(obj--);
    </script>
</body>

</html>